﻿using System;

namespace Cpu6502
{
    public class Stack
    {
        public void Push(Byte val)
        {
            CPU.Registers.S++;
            CPU.Memory[0x1FF - CPU.Registers.S] = val;
        }

        public Byte Pop()
        {
            Byte val = CPU.Memory[0x1FF - CPU.Registers.S];
            CPU.Registers.S--;

            return val;
        }

        public Byte Peek()
        {
            return CPU.Memory[0x1FF - CPU.Registers.S];
        }
    }
}
